#include "car_struct_csv.hpp"
#include "type_conversion.hpp"
#include "travelling.hpp"

using boost::lexical_cast;
using boost::bad_lexical_cast;

car_struct_csv::car_struct_csv(std::vector<std::string> const& v)
{
	
   switch(v.size()-1)
   {
	case OWNERSHIP:
			set_ownership(type_conversion<int>::to_number(v[OWNERSHIP]));
	case TANK:
			set_tank(type_conversion<int>::to_number(v[TANK]));
	case FUEL:
			set_fuel(type_conversion<int>::to_number(v[FUEL]));
	case POWER:	
			set_power(type_conversion<float>::to_number(v[POWER]));
	case PLATE: 
			set_code(v[PLATE]);
	case ID:
			set_id(type_conversion<int>::to_number(v[ID]));
		break;
	default: break;
   }
		
	std::cout << "[car_struct_csv.car_struct_csv] " << *this << std::endl;
}
		

float car_struct_csv::fuel_refund(date& _first_date, date& _last_date, bool _include_last_date)
{
	return travelling_csv::fuel_refund(this->id(), _first_date, _last_date, _include_last_date);
}


